<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]> <html class="no-js" lang="en"> 		   <![endif]-->
<html>
  <head>
    <meta charset="utf-8">
    <!-- You can use .htaccess and remove these lines to avoid edge case issues. -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>
      <?php echo $this->setting_model->item('site_name') ?> - <?php echo $this->lang->line('label.admin.control_panel') ?> - 
      <?php echo $this->lang->line('label.' . ($this->uri->rsegment(2) == 'index' ? $this->router->fetch_class() . 's' : $this->uri->rsegment(2) . '.' . $this->router->fetch_class() )) ?>
    </title>
    <link rel="shortcut icon" href="<?php echo base_url() . APPPATH ?>themes/admin/img/admin/logo.png" />
    <base href="<?php echo base_url() ?>" />
    <!-- Mobile viewport optimized -->
    <meta name="viewport" content="width=device-width,user-scalable=no">
    <meta name="keywords" content="<?php echo $this->setting_model->item('metadata_keywords') ?>" />
    <meta name="description" content="<?php echo $this->setting_model->item('metadata_description') ?>" />
    <link href="<?php echo base_url() . APPPATH ?>themes/admin/css/style.css" type="text/css" rel="stylesheet" />  	<!-- End CSS-->
    <link rel="shortcut icon" href="<?php echo base_url() . APPPATH ?>themes/admin/img/favicon.ico">
    <!-- Grab Google CDN's jQuery, with a protocol relative URL -->
    <script src="<?php echo base_url() . APPPATH ?>themes/admin/js/jquery-1.7.1.min.js"></script>
    <script src="<?php echo base_url() . APPPATH ?>themes/admin/js/ckeditor/wysiwyg.js"></script>
    <script type="text/javascript">
      var CKEDITOR = window.parent.CKEDITOR;
      function windowClose(){
        CKEDITOR.dialog.getCurrent().hide();
      }
      function insertHTML(html){
        window.parent.instance.insertHtml(html);
      }
      (function($) {
        $(window).ready(function() {
          window.parent.jQuery('.cke_dialog_footer').hide();
        });
        $(function() {
          $('a[rel=modal], a.modal').livequery(function() {
            $(this).fancybox({
              overlayOpacity: 0.8, overlayColor: '#000',
              hideOnContentClick: false,
              onClosed: function(){ location.reload(); }
            });
          });
        });
      })(jQuery);
    </script>
    <!--[if lt IE 9]>
    <link href="<?php echo base_url() . APPPATH ?>themes/admin/css/ie8.css" type="text/css" rel="stylesheet" />
    <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
  </head>
  <body>
    <div id="container">
      <section id="content" style="margin: 0px !important">	
        <?php $this->load->view('admin/_noscript') ?>
        <div id="content-body">
          <section class="title">
            <h4><?php echo $this->lang->line('label.' . ($this->uri->rsegment(2) == 'index' ? $this->router->fetch_class() . 's' : $this->uri->rsegment(2) . '.' . $this->router->fetch_class() )) ?></h4>            
          </section>
          <section class="item">
            <div id="files-browser-contents">
              <table border="0" class="table-list">
                <thead>
                  <tr>
                    <th><?php echo $this->lang->line('label.file.name') ?></th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>            
                      <a class="folder-hash" data-path="<?php echo $this->lang->line('label.folder.parent') ?>" 
                         title="<?php echo $this->lang->line('label.folder.parent') ?>" 
                         href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/ajax_file?path=' . dirname($dir)) ?>">
                        <img src="<?php echo base_url() . APPPATH . 'themes/admin/img/icons/folder.png' ?>" 
                             alt="folder" title="folder"/> ..</a>
                    </td>
                    <td class="actions">
                    </td>
                  </tr>
                  <?php foreach ($folders as $obj) { ?>
                    <tr>
                      <td>              
                        <a class="folder-hash" data-path="<?php echo $obj ?>" title="<?php echo $obj ?>" 
                           href="<?php echo site_url('admin/'.$this->router->fetch_class() . '/ajax_file?path=' . $dir . '/' . $obj) ?>">
                          <img src="<?php echo base_url() . APPPATH . 'themes/admin/img/icons/folder.png' ?>" 
                               alt="folder" title="folder"/> <?php echo $obj ?></a></td>
                      <td class="actions"></td>
                    </tr>
                  <?php } ?>
                  <?php foreach ($files as $obj) { ?>
                    <tr>
                      <td>
                        <a class="folder-hash" data-path="<?php echo $obj ?>" title="<?php echo $obj ?>"
                           onclick="insertImage('<?php echo site_url('admin/'.$this->router->fetch_class() .
                          '/view_file?path=' . $dir . '/' . $obj) ?>', '<?php echo $obj ?>'); return false;"
                           href="#">
                          <img src="<?php echo base_url() . APPPATH . 'themes/admin/img/icons/file.png' ?>" 
                               alt="folder" title="folder"/> <?php echo $obj ?></a>
                      </td>
                      <td>
                        <img src="<?php echo site_url('admin/'.$this->router->fetch_class() . '/view_file?path=' . $dir . '/' . $obj) ?>" width="80px"/>
                      </td>
                    </tr>
                  <?php } ?>
                </tbody>
              </table>
            </div>
          </section>
        </div>
      </section>
    </div>
  </body>
</html>